package com.admin.vo;

import lombok.Data;

import java.time.LocalDateTime;

@Data
public class TokenInfo {
//  {
//    "access_token": "9ae7aaab-cae5-461e-b388-3906b6c4dc40",
//    "token_type": "bearer",
//    "expires_in": 3599,
//    "scope": "read write"
//  }
  private String access_token;
  private String token_type;
  private Long expires_in;
  private String scope;
  private String refresh_token;

  private LocalDateTime expireTime;

  public TokenInfo init(){
    expireTime=LocalDateTime.now().plusSeconds(expires_in-3);
    return this;
  }

  public boolean isExpire() {
    return expireTime.isBefore(LocalDateTime.now());
  }
}
